<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改特殊渠道信息')"/>
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-info-edit" th:object="${specialCostomInfo}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">机构名称：</label>
            <div class="col-sm-8">
                <input name="name" th:field="*{name}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">描述信息：</label>
            <div class="col-sm-8">
                <input name="descInfo" th:field="*{descInfo}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">客户经理：</label>
            <div class="col-sm-8">
                <select class="form-control" th:field="*{ownerUserId}" name="ownerUserId">
                    <option th:each="item:${managerInfoList}" th:value="${item.userId}"
                            th:text="${item.username}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">经理姓名：</label>
            <div class="col-sm-8">
                <input name="companyUser" th:field="*{companyUser}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">联系电话：</label>
            <div class="col-sm-8">
                <input name="companyPhone" th:field="*{companyPhone}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">公司名称：</label>
            <div class="col-sm-8">
                <input name="companyName" th:field="*{companyName}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">公司logo：</label>
            <div class="col-sm-8">
                <img alt="[ 产品logo ]" width="90px" height="60px"  src="" id="logoUrl_img" th:src="*{companyLogo}">
                <input name="companyLogo" id="logoUrl" class="form-control" type="hidden" required>
                <input id="inputImage" name="file" type="file" >
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">机构产品名称：</label>
            <div class="col-sm-8">
                <input name="productName" th:field="*{productName}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">最大贷款金额：</label>
            <div class="col-sm-8">
                <input name="maxLoanAmount" th:field="*{maxLoanAmount}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">最大利率：</label>
            <div class="col-sm-8">
                <input name="maxRate" th:field="*{maxRate}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">最小利率：</label>
            <div class="col-sm-8">
                <input name="minRate" th:field="*{minRate}" class="form-control" type="text">
            </div>
        </div>

<!--        <div class="form-group">-->
<!--            <label class="col-sm-3 control-label">推送数量：</label>-->
<!--            <div class="col-sm-8">-->
<!--                <input name="pushNumber" th:field="*{pushNumber}" class="form-control" type="text">-->
<!--            </div>-->
<!--        </div>-->

<!--        <div class="form-group">-->
<!--            <label class="col-sm-3 control-label">推送类型：</label>-->
<!--            <div class="col-sm-8">-->
<!--                <select class="form-control" th:field="*{singlePushFlag}" name="singlePushFlag">-->
<!--                    <option value="1">系统推送</option>-->
<!--                    <option value="0">手动推送</option>-->
<!--                    -->
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->

<!--        <div class="form-group">-->
<!--            <label class="col-sm-3 control-label">账户余额：</label>-->
<!--            <div class="col-sm-8">-->
<!--                <input name="remainAmount" th:field="*{remainAmount}" class="form-control" type="text">-->
<!--            </div>-->
<!--        </div>-->

<!--        <div class="form-group">-->
<!--            <label class="col-sm-3 control-label">风控前置：</label>-->
<!--            <div class="col-sm-8">-->
<!--                <select class="form-control" th:field="*{riskFlag}" name="riskFlag">-->
<!--                    <option value="1">有风控</option>-->
<!--                    <option value="0">无风控</option>-->
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->

<!--        <div class="form-group">-->
<!--            <label class="col-sm-3 control-label">机构类型：</label>-->
<!--            <div class="col-sm-8">-->
<!--                <input th:field="*{infoType}" class="form-control" readonly type="text" id="infoType">-->
<!--            </div>-->
<!--        </div>-->

        <div class="form-group">
            <label class="col-sm-3 control-label"></label>
            <div class="col-sm-8">
                <button type="button" onclick="submitHandler()" class="btn-primary btn">提交</button>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
    var prefix = ctx + "special/info";
    $("#form-info-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.saveTab(prefix + "/edit", $('#form-info-edit').serialize());
        }
    }

    $(document).ready(function () {
        // 单图上传
        $("#inputImage").fileinput({
            uploadUrl: ctx + 'common/upload/specialinfo',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            var rsp = data.response;
            // log.info("return url：" + rsp.url)
            // log.info("reutrn fileName：" + rsp.fileName)
            // log.info("reutrn newFileName：" + rsp.newFileName)
            // log.info("return originalFilename：" + rsp.originalFilename)
            $("#logoUrl").val(rsp.fileUrl)
            $("#logoUrl_img").attr("src", rsp.fileUrl)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
    });

</script>
</body>
</html>